The fit command is used to fit a function, chosen by set function, to a pair of vectors containing the independent and dependent variables. Depending on the type of fit, selected by the set method command, a third vector containing the standard deviation might be required. fit allocates a vector having the name of the dependent variable appended with the string FIT. This vector contains the computed values of the function for the given independent vector. Depending on the method, the built-in constant chi2 will contain the value of the mean square deviation weighted by vector σ-VECTOR or the mean absolute deviation.
fit independent-VECTOR dependent-VECTOR σ-VECTOR
fit X Y DYwill create a vector YFIT containing the value of the fitted function for each of the values of the independent vector X. Note that the standard deviation is required for most fitting routines since it is used to weigh the value of local square deviation from the fit (in fact, this is the definition of χ2). If σ-VECTOR is unavailable just use
let DY=1using the previous example. This simply gives the same weight to all data points.
set method, set function, show fit, show parameters, append